<template>
    <!-- 预警提醒 -->
    <div class="warning-reminder-wrap">
        <div class="left-nav">
          <ul>
            <li
              :class="{active: earlyActive === index}"
              @click="selectNav(index)"
              :key="index"
              v-for="(item,index) in earlyWarning">
              <i class="icon"></i>
              <span>{{ item.name }} ({{item.number}})</span>
            </li>
          </ul>
        </div>
        <div v-show="earlyActive === 0" class="right-content early-warning-a">
          <div class="content-title">
            <i class="line"></i>
            <span class="title">计划提醒</span>
            <ul class="title-toolbar">
              <li
                :class="{active:toolbarActive === index}"
                :key="index"
                @click="selectType(index)"
                v-for="(item,index) in toolbar">
                {{item.name}}({{item.number}})
              </li>
            </ul>
          </div>
          <div class="content-body">
            <el-scrollbar style="height: calc(100% - 35px)">
              <div class="list-wrap">
                <el-row
                  :key="index"
                  v-for="(item,index) in planReminder">
                  <el-col :span="24">
                    <i class="row-icon"></i>
                    <span class="name" :class="{new:item.type === 'new'}">{{item.name}}</span>
                    <span v-if="item.type === 'new'" class="new-icon">new</span>
                    <span class="operation-btn">
                      远程维护 <i class="el-icon-d-arrow-right"></i>
                    </span>
                  </el-col>
                  <el-col class="row-indent" :span="12">
                    <span>上传巡检时间：{{item.time}}</span>
                  </el-col>
                  <el-col :span="12">
                    <span>今天任查巡检次数：{{item.frequency}} 次</span>
                  </el-col>
                </el-row>
              </div>
            </el-scrollbar>
            <div class="paginationWrap">
              <el-pagination
                @size-change="paginationSizeChange"
                @current-change="paginationChange"
                :current-page.sync="currentPage"
                :page-size="pageSize"
                background
                :small = "true"
                popper-class = "select-common-option"
                :page-sizes = "pageList"
                layout="total,sizes,->,prev, pager, next, jumper"
                :total="totalRecords">
                <!--<span class="el-pagination__current">当前第{{currentPage}}/{{totalPage}}页</span>-->
              </el-pagination>
          </div>
        </div>
        </div>
        <div v-show="earlyActive === 1" class="right-content early-warning-b">
          <div class="content-title">
            <i class="line"></i>
            <span class="title">任务提醒</span>
          </div>
          <div class="content-body">
            <el-scrollbar style="height: calc(100% - 35px)">
              <div class="list-wrap">
                <el-row
                  :key="index"
                  v-for="(item,index) in taskWarning">
                  <el-col :span="24">
                    <i class="row-icon"></i>
                    <span class="name" :class="{new:item.type === 'new'}">{{item.name}}</span>
                    <span v-if="item.type === 'new'" class="new-icon">new</span>
                    <span v-if="parseInt(item.state) === 1" class="operation-btn">
                        审核 <i class="el-icon-d-arrow-right"></i>
                    </span>
                    <span v-if="parseInt(item.state) === 2" class="operation-btn">
                        执行 <i class="el-icon-d-arrow-right"></i>
                    </span>
                  </el-col>
                  <el-col class="row-indent" :span="8">
                    <span>到期时间：{{item.time}}</span>
                  </el-col>
                  <el-col :span="8">
                    <span>任务内容：{{item.content}}</span>
                  </el-col>
                  <el-col :span="8">
                    <span>当前状态：</span>
                    <span v-if="parseInt(item.state) === 1" class="state-text state-a"> <i></i> 待审核</span>
                    <span v-if="parseInt(item.state) === 2" class="state-text state-b"> <i></i> 待执行</span>
                    <span v-if="parseInt(item.state) === 3" class="state-text state-c"> <i></i> 已完成</span>
                  </el-col>
                </el-row>
              </div>
            </el-scrollbar>
            <div class="paginationWrap">
              <el-pagination
                @size-change="paginationSizeChange"
                @current-change="paginationChange"
                :current-page.sync="currentPage"
                :page-size="pageSize"
                background
                :small = "true"
                popper-class = "select-common-option"
                :page-sizes = "pageList"
                layout="total,sizes,->,prev, pager, next, jumper"
                :total="totalRecords">
                <!--<span class="el-pagination__current">当前第{{currentPage}}/{{totalPage}}页</span>-->
              </el-pagination>
            </div>
          </div>
        </div>
        <div v-show="earlyActive === 2" class="right-content early-warning-b">
        <div class="content-title">
          <i class="line"></i>
          <span class="title">故障处理提醒</span>
        </div>
        <div class="content-body">
          <el-scrollbar style="height: calc(100% - 35px)">
            <div class="list-wrap">
              <el-row
                :key="index"
                v-for="(item,index) in faultHandling">
                <el-col :span="24">
                  <i class="row-icon"></i>
                  <span class="name" :class="{new:item.type === 'new'}">{{item.name}}</span>
                  <span v-if="item.type === 'new'" class="new-icon">new</span>
                </el-col>
                <el-col class="row-indent" :span="6">
                  <span>持续时长：{{item.time}}</span>
                </el-col>
                <el-col :span="6">
                  <span>站点：{{item.site}}</span>
                </el-col>
                <el-col :span="6">
                  <span>责任人：{{item.liable}}</span>
                </el-col>
                <el-col :span="6">
                  <span>当前状态：</span>
                  <span v-if="parseInt(item.state) === 1" class="state-text state-a"> <i></i> 待处理</span>
                  <span v-if="parseInt(item.state) === 2" class="state-text state-b"> <i></i> 待审核</span>
                  <span v-if="parseInt(item.state) === 3" class="state-text state-c"> <i></i> 已处理</span>
                </el-col>
              </el-row>
            </div>
          </el-scrollbar>
          <div class="paginationWrap">
            <el-pagination
              @size-change="paginationSizeChange"
              @current-change="paginationChange"
              :current-page.sync="currentPage"
              :page-size="pageSize"
              background
              :small = "true"
              popper-class = "select-common-option"
              :page-sizes = "pageList"
              layout="total,sizes,->,prev, pager, next, jumper"
              :total="totalRecords">
              <!--<span class="el-pagination__current">当前第{{currentPage}}/{{totalPage}}页</span>-->
            </el-pagination>
          </div>
        </div>
      </div>
        <div v-show="earlyActive === 3" class="right-content early-warning-a">
          <div class="content-title">
            <i class="line"></i>
            <span class="title">车辆保险提醒</span>
          </div>
          <div class="content-body">
            <el-scrollbar style="height: calc(100% - 35px)">
              <div class="list-wrap">
                <el-row
                  :key="index"
                  v-for="(item,index) in vehicleInsurance">
                  <el-col :span="24">
                    <i class="row-icon"></i>
                    <span class="name" :class="{new:item.type === 'new'}">{{item.name}}</span>
                    <span v-if="item.type === 'new'" class="new-icon">new</span>
                    <span class="operation-btn">
                        编辑 <i class="el-icon-d-arrow-right"></i>
                      </span>
                  </el-col>
                  <el-col class="row-indent" :span="12">
                    <span>保险到期时间：{{item.time}}</span>
                  </el-col>
                  <el-col :span="12">
                    <span v-if="parseInt(item.state) === 1">状态：{{item.content}}</span>
                    <span v-if="parseInt(item.state) === 2" style="color: red;">状态：{{item.content}}</span>
                  </el-col>
                </el-row>
              </div>
            </el-scrollbar>
            <div class="paginationWrap">
              <el-pagination
                @size-change="paginationSizeChange"
                @current-change="paginationChange"
                :current-page.sync="currentPage"
                :page-size="pageSize"
                background
                :small = "true"
                popper-class = "select-common-option"
                :page-sizes = "pageList"
                layout="total,sizes,->,prev, pager, next, jumper"
                :total="totalRecords">
                <!--<span class="el-pagination__current">当前第{{currentPage}}/{{totalPage}}页</span>-->
              </el-pagination>
            </div>
          </div>
        </div>
        <div v-show="earlyActive === 4" class="right-content early-warning-a">
        <div class="content-title">
          <i class="line"></i>
          <span class="title">车辆年检提醒</span>
        </div>
        <div class="content-body">
          <el-scrollbar style="height: calc(100% - 35px)">
            <div class="list-wrap">
              <el-row
                :key="index"
                v-for="(item,index) in vehicleInspection">
                <el-col :span="24">
                  <i class="row-icon"></i>
                  <span class="name" :class="{new:item.type === 'new'}">{{item.name}}</span>
                  <span v-if="item.type === 'new'" class="new-icon">new</span>
                  <span class="operation-btn">
                      编辑 <i class="el-icon-d-arrow-right"></i>
                    </span>
                </el-col>
                <el-col class="row-indent" :span="12">
                  <span>年检到期时间：{{item.time}}</span>
                </el-col>
                <el-col :span="12">
                  <span v-if="parseInt(item.state) === 1">状态：{{item.content}}</span>
                  <span v-if="parseInt(item.state) === 2" style="color: red;">状态：{{item.content}}</span>
                </el-col>
              </el-row>
            </div>
          </el-scrollbar>
          <div class="paginationWrap">
            <el-pagination
              @size-change="paginationSizeChange"
              @current-change="paginationChange"
              :current-page.sync="currentPage"
              :page-size="pageSize"
              background
              :small = "true"
              popper-class = "select-common-option"
              :page-sizes = "pageList"
              layout="total,sizes,->,prev, pager, next, jumper"
              :total="totalRecords">
              <!--<span class="el-pagination__current">当前第{{currentPage}}/{{totalPage}}页</span>-->
            </el-pagination>
          </div>
        </div>
      </div>
        <div v-show="earlyActive === 5" class="right-content early-warning-b">
        <div class="content-title">
          <i class="line"></i>
          <span class="title">备品备件提醒</span>
        </div>
        <div class="content-body">
          <el-scrollbar style="height: calc(100% - 35px)">
            <div class="list-wrap">
              <el-row
                :key="index"
                v-for="(item,index) in spareParts">
                <el-col :span="24">
                  <i class="row-icon"></i>
                  <span class="name" :class="{new:item.type === 'new'}">{{item.name}}</span>
                  <span v-if="item.type === 'new'" class="new-icon">new</span>
                  <span class="operation-btn">
                        录入更换记录 <i class="el-icon-d-arrow-right"></i>
                  </span>
                </el-col>
                <el-col class="row-indent" :span="8">
                  <span>上传更换时间：{{item.time}}</span>
                </el-col>
                <el-col :span="5">
                  <span>已用时长：{{item.duration}}</span>
                </el-col>
                <el-col :span="5">
                  <span>建议用时：{{item.useTime}}</span>
                </el-col>
                <el-col :span="5">
                  <span>站点：{{item.site}}</span>
                </el-col>
              </el-row>
            </div>
          </el-scrollbar>
          <div class="paginationWrap">
            <el-pagination
              @size-change="paginationSizeChange"
              @current-change="paginationChange"
              :current-page.sync="currentPage"
              :page-size="pageSize"
              background
              :small = "true"
              popper-class = "select-common-option"
              :page-sizes = "pageList"
              layout="total,sizes,->,prev, pager, next, jumper"
              :total="totalRecords">
              <!--<span class="el-pagination__current">当前第{{currentPage}}/{{totalPage}}页</span>-->
            </el-pagination>
          </div>
        </div>
      </div>
    </div>
</template>

<script>
    export default {
        name: "warningReminder",
        data(){
           return{
             earlyActive:0,
             earlyWarning:[
               {
                 name: '计划提醒',
                 number:'8',
               },{
                 name: '任务提醒',
                 number:'10',
               },{
                 name: '故障处理提醒',
                 number:'8',
               },{
                 name: '车辆保险提醒',
                 number:'9',
               },{
                 name: '车辆年检提醒',
                 number:'12',
               },{
                 name: '备品备件提醒',
                 number:'13',
               }
             ],
             toolbar:[
               {
                 name:'日巡检',
                 number:'5'
               },{
                 name:'周巡检',
                 number:'3'
               }
             ],
             toolbarActive: 0,
             currentPage: 1, //分页组件当前页
             pageSize: 10, //分页每页多少条数据
             totalRecords: 0, //总条数
             pageList: [10, 15, 20], //设置每页多少条
             //计划提醒列表数据
             planReminder:[
               {
                 name:'梅溪湖水站',
                 type:'new',
                 time:'2019-06-20 10:20:00',
                 frequency:'2'
               },{
                 name:'梅溪湖水站2',
                 type:'new',
                 time:'2019-06-21 10:20:00',
                 frequency:'3'
               },{
                 name:'梅溪湖水站3',
                 type:'normal',
                 time:'2019-06-22 10:20:00',
                 frequency:'1'
               }
             ],
             //任务提醒列表数据
             taskWarning:[
               {
                 name:'梅溪湖水站',
                 type:'new',
                 time:'2019-06-20 10:20:00',
                 content:'站点巡检',
                 state: '1'
               },{
                 name:'梅溪湖水站',
                 type:'new',
                 time:'2019-06-20 10:20:00',
                 content:'站点巡检',
                 state: '2'
               },{
                 name:'梅溪湖水站',
                 type:'normal',
                 time:'2019-06-20 10:20:00',
                 content:'站点巡检',
                 state: '3'
               }
             ],
             //故障处理提醒
             faultHandling:[
               {
                 name:'仪器故障处理',
                 type:'new',
                 time:'1小时30分钟',
                 site:'梅溪湖水站',
                 liable:'张三水',
                 state: '1'
               },{
                 name:'仪器故障处理',
                 type:'normal',
                 time:'1小时30分钟',
                 site:'梅溪湖水站',
                 liable:'张三水',
                 state: '1'
               },{
                 name:'仪器故障处理',
                 type:'normal',
                 time:'1小时30分钟',
                 site:'梅溪湖水站',
                 liable:'张三水',
                 state: '1'
               }
             ],
             //车辆保险提醒
             vehicleInsurance:[
               {
                 name:'粤A478FC',
                 type:'new',
                 time:'2019-06-01',
                 content:'保险已过期27天',
                 state: '2'
               },{
                 name:'粤A478FC',
                 type:'new',
                 time:'2019-06-01',
                 content:'保险已过期27天',
                 state: '2'
               },{
                 name:'粤A478FC',
                 type:'normal',
                 time:'2019-07-01',
                 content:'保险还有3天过期',
                 state: '1'
               }
             ],
             vehicleInspection:[
               {
                 name:'粤A478FC',
                 type:'new',
                 time:'2019-06-01',
                 content:'年检已过期27天',
                 state: '2'
               },{
                 name:'粤A478FC',
                 type:'new',
                 time:'2019-06-01',
                 content:'年检已过期27天',
                 state: '2'
               },{
                 name:'粤A478FC',
                 type:'new',
                 time:'2019-07-01',
                 content:'年检还有3天过期',
                 state: '1'
               }
             ],
             spareParts:[
               {
                 name: '氨氮分析仪',
                 type: 'new',
                 time: '2019-06-01',
                 duration: '42天',
                 useTime: '60天',
                 site: '梅溪湖水站'
               },{
                 name: '氨氮分析仪',
                 type: 'new',
                 time: '2019-06-01',
                 duration: '42天',
                 useTime: '60天',
                 site: '梅溪湖水站'
               },{
                 name: '氨氮分析仪',
                 type: 'normal',
                 time: '2019-06-01',
                 duration: '42天',
                 useTime: '60天',
                 site: '梅溪湖水站'
               }
             ]
           }
        },
        computed: {
          totalPage() {
            //计算总页数
            let number = 0;
            number = Math.ceil(this.totalRecords / this.pageSize);
            return number === 0 ? 1 : number;
          }
        },
        methods:{
          selectNav(index){
            this.earlyActive = index;
          },
          selectType(index){
            this.toolbarActive = index;
          },
          paginationChange(val) {
            //分页页码改变时执行
            this.currentPage = val;
          },
          //分页pageSize改变时执行
          paginationSizeChange(val) {
            this.pageSize = val;
          },
        }
    }
</script>

<style scoped lang="less">
.warning-reminder-wrap{
  height: 580px;
  padding: 8px;
}
.left-nav{
  width: 210px;
  border: 1px solid #d9e6f7;
  height: 100%;
  float: left;
  padding-top: 13px;
  ul{
    &>li{
      padding: 13px 0 16px 21px;
      font-size: 12px;
      margin-left: -7px;
      cursor: pointer;
      .icon{
        display: inline-block;
        vertical-align: middle;
        margin-bottom: 3px;
        margin-right: 4px;
        width: 10px;
        height: 10px;
        border: 1px solid #adb4bb;
        border-radius: 50%;
        &:before{
          content: '';
          display: block;
          width: 4px;
          height: 4px;
          border: 1px solid #adb4bb;
          border-radius: 50%;
          margin: 1px;
        }
      }
    }
    &>li.active{
      position: relative;
      background: url("../../assets/images/nav/y_di_link_bg.png") no-repeat left center;
      background-size: 100%;
      color: #fff;
      .icon{
        border-color: #fff;
        &:before{
          border-color: #fff;
        }
      }
    }
  }
}
.right-content{
  width: calc(100% - 218px);
  border: 1px solid #d9e6f7;
  height: 100%;
  float: right;
  .content-title{
    height: 37px;
    line-height: 36px;
    border-bottom: 1px solid #d9e6f7;
    padding-left: 15px;
    .line{
      display: inline-block;
      vertical-align: middle;
      margin-bottom: 3px;
      width: 3px;
      height: 10px;
      background: #0b61ff;
      margin-right: 4px;
    }
    .title{
      font-size: 15px;
    }
    .title-toolbar{
      float: right;
      height: 36px;
      line-height: 36px;
      &>li{
        float: left;
        padding: 0 14px;
        font-size: 12px;
        cursor: pointer;
      }
      &>li.active{
        color: #166bce;
        border-bottom: 2px solid #0b61ff;
      }
    }
  }
  .content-body{
    height: calc(100% - 37px);
    .list-wrap{
      padding: 0 8px;
      &>.el-row{
        padding: 10px 8px;
        line-height: 30px;
        border-bottom: 1px solid #d9e6f7;
        font-size: 12px;
        .row-icon{
          display: inline-block;
          vertical-align: middle;
          margin-bottom: 3px;
          width: 20px;
          height: 20px;
          border-radius: 50%;
          background: #0b61ff;
          margin-right: 6px;
        }
        .name{
          font-size: 16px;
          color: #666666;
          vertical-align: middle;
          display: inline-block;
          margin-bottom: 3px;
        }
        .new.name{
          /*font-weight: 700;*/
          color: #333333;
        }
        .new-icon{
          display: inline-block;
          vertical-align: middle;
          margin-bottom: 3px;
          background: #ff8e2f;
          color: #fff;
          padding: 0 4px;
          height: 16px;
          border-radius: 2px;
          font-size: 12px;
          line-height: 16px;
          margin-left: 4px;
        }
        .operation-btn{
          float: right;
          color: #0b61ff;
          cursor: pointer;
          opacity: 0.8;
          &:hover{
            opacity: 1;
          }
        }
        .row-indent{
          padding-left: 29px;
        }
      }
    }
  }

}
.early-warning-b{
  .content-body{
    .el-row{
      .el-col{
        text-align: center;
      }
      .el-col:first-child,.row-indent{
        text-align: left;
      }
    }
  }
}
.paginationWrap{
  border-top: 1px solid #d9e6f7;
  padding: 4px 6px;
}
.state-text{
  i{
    display: inline-block;
    vertical-align: middle;
    margin-bottom: 3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;

  }
}
.state-a,.state-b{
  i{
    background: #ff8e2f;
  }
}
.state-c{
  i{
    background: #36c25e;
  }
}
</style>
